window.onload = () => {
  // return
  // 获取元素
  let search = document.getElementById('search')
  let dialog = document.querySelector('.search-content')
  let dialogSpan = document.querySelector('.search-content span')
  let btn = document.getElementById('closeDialog')
  // 点击搜索框
  search.addEventListener('change', () => {
  // 显示弹窗
    dialog.style.display = 'block'
    // 获取搜索框的值
    dialogSpan.innerHTML = search.value    
  })
  // 点击关闭按钮
  btn.addEventListener('click', () => {
    // 隐藏弹窗
    dialog.style.display = 'none'
    // 清空搜索框的值
    dialogSpan.innerHTML = ''
    search.value = ''
  })
  // 获取元素
  let up = document.getElementById('up')
  // 返回点击顶部
  up.onclick = () => {   //  点击事件
    window.scrollTo({
      top: 0, // 滚动条的高度
      behavior: 'smooth', // 平滑滚动
    })
  }
}
